class Rectangle {

    constructor(width,height) {
        this.width = width;
        this.height = height;
    }

    getArea() {
        return this.width * this.height;
    }

    getPer() {
        return 2 * (this.width + this.height);
    }

}

class Square extends Rectangle {

    constructor(side) {
        super(side,side);
    }

}

let rect = new Rectangle(100,50);
console.log(rect.getArea());
console.log(rect.getPer());

rect = new Rectangle(70,20);
console.log(rect.getArea());
console.log(rect.getPer());

let square = new Square(10);
console.log(square.getArea());
console.log(square.getPer());